package cn.bone.motan.demo1.dao;

import cn.bone.motan.demo1.bean.Motan;
import org.mongodb.morphia.Datastore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

/**
 * Created by MD-01 on 2017/4/18.
 */
@Repository
public class MotanDao {

    private Logger logger = LoggerFactory.getLogger(MotanDao.class);

    @Resource
    private Datastore datastore;

    @Async("logAsync")
    public void add(Motan motan){

        logger.info("存储数据到mongodb");
        datastore.save(motan);
    }
}
